package com.test.test01.schedule.register;

import java.util.concurrent.ScheduledFuture;

/**
 * Description:
 * Create DateTime: 2021/1/4 下午4:20
 *
 * @author houyi
 */
public final class ScheduledTask {

    volatile ScheduledFuture<?> future;

    /**
     * 取消定时任务 ->删除线程中的此任务
     */
    public void cancel() {
        ScheduledFuture<?> future = this.future;
        if (future != null) {
            future.cancel(true);
        }
    }
}
